<?php
/**
 * 校验表单数据规则
 * Created by Sublime Text 3.
 * @authors Rejeo (rejeo@qq.com)
 * @date    2018-04-25 14:51:53
 * @version $Id$
 */
namespace app\bis\validate;

use think\Validate;

class Register extends Validate {

    /*验证规则，注意多去使用一些内置规则*/
    protected $rule = [
        'id'           => 'number',
        'parent_id'    => 'number',
        'name'         => 'require|max:30|unique:bis',
        'city_id'      => 'require|number',
        'se_city_id'   => 'require|number',
        'logo'         => 'require',
        'licence_logo' => 'require',
        'bank_info'    => 'require|number',
        'bank_name'    => 'require',
        'bank_user'    => 'require',
        'faren'        => 'require',
        'faren_tel'    => 'require',
        'email'        => 'email',
        'tel'          => 'require',
        'contact'      => 'require',
        'category_id'  => 'require',
        'address'      => 'require',
        'open_time'    => 'require',
        'username'     => 'require',
        'password'     => 'require',
        'status'       => 'number|in:-1,0,1',
        'listorder'    => 'number',
    ];

    /*验证提示*/
    protected $message = [

    ];
    /*场景验证*/
    /*如验证add场景（该场景定义只需要验证name和parent_id字段）*/
    protected $scene = [
        'add' => ['name','city_id','email','category_id'],
        'status' => ['id','status'],
        // 'links' => ['title'=>'require|max:30|unique:links','url','desc'],
    ];

}
